package org.common.eureka.controller;

import org.common.eureka.service.IUserFeignClient;
import org.sam.commons.entity.pojo.SecUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "/archives")
public class ArchivesController {

    @Autowired
    private IUserFeignClient userFeignClient;

    /**
     * 获取用户对象信息
     *
     * @param id
     * @return
     */
    @GetMapping("/user/{id}")
    public SecUser queryOne(@PathVariable String id) {
        return userFeignClient.queryOne(id);
    }

    @GetMapping("/users")
    public List queryAll() {
        return userFeignClient.queryAll();
    }

    @GetMapping("/user/name/{userName}")
    public String queryJsonByName(@PathVariable String userName) {
        return this.userFeignClient.queryJsonByName(userName);
    }
}
